#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int factorial_plan_1(int n)
{
	if (n == 0)
		return 1;
	else
		return n * factorial_plan_1(n - 1);
}

int factorial_plan_2(int n)
{
	int result = 1;
	int i = 0;
	for (i = 1; i <= n; i++)
	{
		result *= i;
	}
	return result;
}

int main()
{
	int n = 0;
	scanf("%d", &n);
	printf("%d\n", factorial_plan_1(n));
	printf("%d\n", factorial_plan_2(n));
	return 0;
}